package org.smileface.designpattern.builder;

import cn.hutool.core.map.MapBuilder;

/**
 * @description:
 * @author: chujian
 * @since: 2022-02-19 21:48
 **/
public class BuilderMain {

    public static void main(String[] args) {
        HttpClient client = new HttpClient.HttpClientBuilder()
                .protocol("http")
                .url("http://www.baidu.com")
                .body("abc")
                .method("get")
                .params(MapBuilder.<String, String>create()
                        .put("version", "v1")
                        .build()
                )
                .addHeader("content-type", "application/json")
                .build();

        System.out.println(client);


        /// lombok
        HttpClient2.HttpClient2Builder builder = new HttpClient2.HttpClient2Builder();
        HttpClient2 client2 = builder.protocol("http")
                .url("http://www.baidu.com")
                .body("abc")
                .method("get")
                .params(MapBuilder.<String, String>create()
                        .put("version", "v1")
                        .build()
                )
                .build();

    }

}
